<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>
        <ui:composition template="../templates/default3.xhtml">
            <ui:define name="content">
                <h:form id="addWarehouseZone" binding="#{warehouseManagerBean.loadAddWarehouseZone}">
                    <p:panel id="addWarehouseZone" header="Add a Warehouse Zone">
                        <p:messages />

                        <table border="0" width="100%">
                            <tr>
                                <td width="150px">Zone Name:</td>
                                <td>
                                    <h:inputText id="zoneName" label="Zone Name" required="true" 
                                                 requiredMessage="Zone name cannot be empty."
                                                 title="Name of the zone."
                                                 value="#{warehouseManagerBean.zoneName}">
                                    </h:inputText>
                                    <font class="fieldNote">*</font>
                                </td>
                            </tr>
                            <tr>
                                <td width="150px">Current Quantity:</td>
                                <td>
                                    <h:inputText id="currentQuantity" label="Current Quantity" required="true" 
                                                 requiredMessage="Current quantity cannot be empty."
                                                 title="Current quantity of the warehouse zone."
                                                 value="#{warehouseManagerBean.currentQuantity}">
                                        <f:convertNumber type="number" />
                                    </h:inputText>
                                    <font class="fieldNote">*</font>
                                </td>
                            </tr>
                            <tr>
                                <td width="150px">Quantity Limit:</td>
                                <td>
                                    <h:inputText id="quantityLimit" label="Quantity Limit" required="true" 
                                                 requiredMessage="Quantity limit cannot be empty."
                                                 title="Quantity limit of the warehouse zone."
                                                 value="#{warehouseManagerBean.quantityLimit}">
                                        <f:convertNumber type="number" />
                                    </h:inputText>
                                    <font class="fieldNote">*</font>
                                </td>
                            </tr>
                            <tr>
                                <td width="170px">Zone Type:</td>
                                <td>
                                    <h:selectOneMenu id="selectOneType" value="#{warehouseManagerBean.type}"
                                                     title="Type of Zone.">
                                        <f:selectItem itemLabel="- Select Zone Type -" itemValue="" />
                                        <f:selectItem itemLabel="Inventory" itemValue="Inventory" />
                                        <f:selectItem itemLabel="Raw Materials" itemValue="Raw Materials" />
                                    </h:selectOneMenu>
                                    <font class="fieldNote">*</font>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center"><hr/>
                                    <p:commandButton id="btnAddZone" value="Add Zone"
                                                     ajax="true" title="Add a zone."
                                                     update="addWarehouseZone"
                                                     actionListener="#{warehouseManagerBean.addAWarehouseZone}"/>
                                    &nbsp;&nbsp;&nbsp;
                                    <p:commandButton id="btnBackFromAddZone" value="Back"
                                                     immediate="true" ajax="true"
                                                     title="Go back to the previous page."
                                                     actionListener="#{warehouseManagerBean.back}"/>
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>
